<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  
  <title>找到一个很好玩的python代码 | 微笔记，大内涵</title>
  
  

  
  <link rel="alternate" href="/atom.xml" title="微笔记，大内涵">
  

  <meta name="HandheldFriendly" content="True" />
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <!-- meta -->
  
  
  <meta name='theme-color' content='#FFFFFF'>
  <meta name='msapplication-TileColor' content='#1BC3FB'>
  <meta name='msapplication-config' content='https://cdn.jsdelivr.net/gh/xaoxuu/cdn-favicon@19.9.6/browserconfig.xml'>
  

  <!-- link -->
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css" />
  
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/node-waves@0.7.6/dist/waves.min.css">
  
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.10.1/css/all.min.css">
  
  
  <link rel='shortcut icon' type='image/x-icon' href='https://pic.stackoverflow.wiki/uploadImages/117/157/217/181/2020/02/02/18/04/3c6d30f9-7f87-485a-aa46-0773160235b4.ico'>
  <link rel='icon' type='image/x-icon' sizes='32x32' href='https://s2.ax1x.com/2020/02/02/1YyRFP.png'>
  <link rel='apple-touch-icon' type='image/png' sizes='180x180' href='https://cdn.jsdelivr.net/gh/xaoxuu/cdn-favicon@19.9.6/apple-touch-icon.png'>
  <link rel='mask-icon' color='#1BC3FB' href='https://cdn.jsdelivr.net/gh/xaoxuu/cdn-favicon@19.9.6/safari-pinned-tab.svg'>
  <link rel='manifest' href='https://cdn.jsdelivr.net/gh/xaoxuu/cdn-favicon@19.9.6/site.webmanifest'>
  

  

  
    
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/xaoxuu/cdn-material-x@19.11.26/css/style.css">

  

  <script>
    function setLoadingBarProgress(num) {
      document.getElementById('loading-bar').style.width=num+"%";
    }
  </script>

  
  
<meta name="generator" content="Hexo 4.2.0"><link rel="alternate" href="/atom.xml" title="微笔记，大内涵" type="application/atom+xml">
</head>

<body>
  
<!-- 数字雨 -->
  <!--<canvas id="canvas" width="1440" height="900" ></canvas>
  <script type="text/javascript" src="/js/DigitalRain.js"></script>-->
<!--浏览器搞笑标题-->
<script type="text/javascript" src="/js/FunnyTitle.js"></script>
<!--动态线条背景-->
<script type="text/javascript"
    color="220,220,220" opacity='1' zIndex="0" count="200" src="//cdn.bootcss.com/canvas-nest.js/1.0.0/canvas-nest.min.js">
</script>
  
  <div class="cover-wrapper">
    <cover class='cover post half'>
      
        
  <img class='logo' src='https://s2.ax1x.com/2020/02/03/1UGGKP.png'/>


  <div class="m_search">
    <form name="searchform" class="form u-search-form">
      <input type="text" class="input u-search-input" placeholder="" />
      <i class="icon fas fa-search fa-fw"></i>
    </form>
  </div>

<div class='menu navgation'>
  <ul class='h-list'>
    
      
        <li>
          <a class="nav home" href="/"
            
            
            id="home">
            <i class='fas fa-rss fa-fw'></i>&nbsp;博文
          </a>
        </li>
      
        <li>
          <a class="nav home" href="/projects/"
            
            
            id="projects">
            <i class='fas fa-code-branch fa-fw'></i>&nbsp;项目
          </a>
        </li>
      
        <li>
          <a class="nav home" href="/about/"
            
              rel="nofollow"
            
            
            id="about">
            <i class='fas fa-info-circle fa-fw'></i>&nbsp;关于
          </a>
        </li>
      
    
  </ul>
</div>

      
    </cover>
    <header class="l_header pure">
  <div id="loading-bar-wrapper">
    <div id="loading-bar" class="pure"></div>
  </div>

	<div class='wrapper'>
		<div class="nav-main container container--flex">
      <a class="logo flat-box" href='/' >
        
          微笔记，大内涵
        
      </a>
			<div class='menu navgation'>
				<ul class='h-list'>
          
  					
  						<li>
								<a class="nav flat-box" href="/"
                  
                  
                  id="home">
									<i class='fas fa-grin fa-fw'></i>&nbsp;主页
								</a>
							</li>
      			
  						<li>
								<a class="nav flat-box" href="/categories/"
                  
                    rel="nofollow"
                  
                  
                  id="categories">
									<i class='fas fa-folder-open fa-fw'></i>&nbsp;分类
								</a>
							</li>
      			
  						<li>
								<a class="nav flat-box" href="/tags/"
                  
                    rel="nofollow"
                  
                  
                  id="tags">
									<i class='fas fa-hashtag fa-fw'></i>&nbsp;标签
								</a>
							</li>
      			
  						<li>
								<a class="nav flat-box" href="/archives/"
                  
                    rel="nofollow"
                  
                  
                  id="archives">
									<i class='fas fa-archive fa-fw'></i>&nbsp;归档
								</a>
							</li>
      			
      		
				</ul>
			</div>

			
				<div class="m_search">
					<form name="searchform" class="form u-search-form">
						<input type="text" class="input u-search-input" placeholder="搜索" />
						<i class="icon fas fa-search fa-fw"></i>
					</form>
				</div>
			
			<ul class='switcher h-list'>
				
					<li class='s-search'><a class="fas fa-search fa-fw" href='javascript:void(0)'></a></li>
				
				<li class='s-menu'><a class="fas fa-bars fa-fw" href='javascript:void(0)'></a></li>
			</ul>
		</div>

		<div class='nav-sub container container--flex'>
			<a class="logo flat-box"></a>
			<ul class='switcher h-list'>
				<li class='s-comment'><a class="flat-btn fas fa-comments fa-fw" href='javascript:void(0)'></a></li>
        
          <li class='s-toc'><a class="flat-btn fas fa-list fa-fw" href='javascript:void(0)'></a></li>
        
			</ul>
		</div>
	</div>
</header>
	<aside class="menu-phone">
    <header>
		<nav class="menu navgation">
      <ul>
        
          
            <li>
							<a class="nav flat-box" href="/"
                
                
                id="home">
								<i class='fas fa-clock fa-fw'></i>&nbsp;近期文章
							</a>
            </li>
          
            <li>
							<a class="nav flat-box" href="/archives/"
                
                  rel="nofollow"
                
                
                id="archives">
								<i class='fas fa-archive fa-fw'></i>&nbsp;文章归档
							</a>
            </li>
          
            <li>
							<a class="nav flat-box" href="/about/"
                
                  rel="nofollow"
                
                
                id="about">
								<i class='fas fa-info-circle fa-fw'></i>&nbsp;关于小站
							</a>
            </li>
          
       
      </ul>
		</nav>
    </header>
	</aside>
<script>setLoadingBarProgress(40);</script>

  </div>


  <div class="l_body">
    <div class='body-wrapper'>
      <div class='l_main'>
  

  <article id="post" class="post white-box article-type-post" itemscope itemprop="blogPost">
    


  <section class='meta'>
    
    
    <div class="meta" id="header-meta">
      
        
  
    <h1 class="title">
      <a href="/blog/%E6%89%BE%E5%88%B0%E4%B8%80%E4%B8%AA%E5%BE%88%E5%A5%BD%E7%8E%A9%E7%9A%84python%E4%BB%A3%E7%A0%81/">
        找到一个很好玩的python代码
      </a>
    </h1>
  


      
      <div class='new-meta-box'>
        
          
        
          
            
  <div class='new-meta-item author'>
    
      <a href="https://chident.gitee.io" rel="nofollow">
        
          <i class="fas fa-user" aria-hidden="true"></i>
        
        <p>Chident</p>
      </a>
    
  </div>


          
        
          
            <div class="new-meta-item date">
  <a class='notlink'>
    <i class="fas fa-calendar-alt" aria-hidden="true"></i>
    <p>2019-09-12</p>
  </a>
</div>

          
        
          
            

          
        
          
            
  
    <div class="new-meta-item browse busuanzi">
      <a class='notlink'>
        <i class="fas fa-eye" aria-hidden="true"></i>
        <p>
          <span id="busuanzi_value_page_pv">
            <i class="fas fa-spinner fa-spin fa-fw" aria-hidden="true"></i>
          </span>
        </p>
      </a>
    </div>
  


          
        
          
            
  
    <div class="new-meta-item wordcount">
      <a class='notlink'>
        <i class="fas fa-keyboard" aria-hidden="true"></i>
        <p>字数统计:</p>
        <p>931字</p>
      </a>
    </div>
    <div class="new-meta-item readtime">
      <a class='notlink'>
        <i class="fas fa-hourglass-half" aria-hidden="true"></i>
        <p>阅读时长≈</p>
        <p>5分</p>
      </a>
    </div>
  

          
        
          
            

          
        
      </div>
      
        <hr>
      
    </div>
  </section>


    <section class="article typo">
      <div class="article-entry" itemprop="articleBody">
        <p>这是一个画佩奇的代码,调用了python的turtle库</p>
<a id="more"></a> 

<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br><span class="line">200</span><br><span class="line">201</span><br><span class="line">202</span><br><span class="line">203</span><br><span class="line">204</span><br><span class="line">205</span><br><span class="line">206</span><br><span class="line">207</span><br><span class="line">208</span><br><span class="line">209</span><br><span class="line">210</span><br><span class="line">211</span><br><span class="line">212</span><br><span class="line">213</span><br><span class="line">214</span><br><span class="line">215</span><br><span class="line">216</span><br><span class="line">217</span><br><span class="line">218</span><br><span class="line">219</span><br><span class="line">220</span><br><span class="line">221</span><br><span class="line">222</span><br><span class="line">223</span><br><span class="line">224</span><br><span class="line">225</span><br><span class="line">226</span><br><span class="line">227</span><br><span class="line">228</span><br><span class="line">229</span><br><span class="line">230</span><br><span class="line">231</span><br><span class="line">232</span><br><span class="line">233</span><br><span class="line">234</span><br><span class="line">235</span><br><span class="line">236</span><br><span class="line">237</span><br><span class="line">238</span><br><span class="line">239</span><br><span class="line">240</span><br><span class="line">241</span><br><span class="line">242</span><br><span class="line">243</span><br><span class="line">244</span><br><span class="line">245</span><br><span class="line">246</span><br><span class="line">247</span><br><span class="line">248</span><br><span class="line">249</span><br><span class="line">250</span><br><span class="line">251</span><br><span class="line">252</span><br><span class="line">253</span><br><span class="line">254</span><br><span class="line">255</span><br><span class="line">256</span><br><span class="line">257</span><br><span class="line">258</span><br><span class="line">259</span><br><span class="line">260</span><br><span class="line">261</span><br><span class="line">262</span><br><span class="line">263</span><br><span class="line">264</span><br><span class="line">265</span><br><span class="line">266</span><br><span class="line">267</span><br><span class="line">268</span><br><span class="line">269</span><br><span class="line">270</span><br><span class="line">271</span><br><span class="line">272</span><br><span class="line">273</span><br><span class="line">274</span><br><span class="line">275</span><br><span class="line">276</span><br><span class="line">277</span><br><span class="line">278</span><br><span class="line">279</span><br><span class="line">280</span><br><span class="line">281</span><br><span class="line">282</span><br><span class="line">283</span><br><span class="line">284</span><br><span class="line">285</span><br><span class="line">286</span><br><span class="line">287</span><br><span class="line">288</span><br></pre></td><td class="code"><pre><span class="line"># coding:utf-8</span><br><span class="line">import turtle as t</span><br><span class="line"># 绘制小猪佩奇</span><br><span class="line"># &#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;</span><br><span class="line"></span><br><span class="line">t.pensize(4)</span><br><span class="line">t.hideturtle()</span><br><span class="line">t.colormode(255)</span><br><span class="line">t.color((255, 155, 192), &quot;pink&quot;)</span><br><span class="line">t.setup(840, 500)</span><br><span class="line">t.speed(10)</span><br><span class="line"></span><br><span class="line"># 鼻子</span><br><span class="line">t.pu()</span><br><span class="line">t.goto(-100,100)</span><br><span class="line">t.pd()</span><br><span class="line">t.seth(-30)</span><br><span class="line">t.begin_fill()</span><br><span class="line">a &#x3D; 0.4</span><br><span class="line">for i in range(120):</span><br><span class="line">    if 0 &lt;&#x3D; i &lt; 30 or 60 &lt;&#x3D; i &lt; 90:</span><br><span class="line">        a &#x3D; a+0.08</span><br><span class="line">        t.lt(3)  # 向左转3度</span><br><span class="line">        t.fd(a)  # 向前走a的步长</span><br><span class="line">    else:</span><br><span class="line">        a &#x3D; a-0.08</span><br><span class="line">        t.lt(3)</span><br><span class="line">        t.fd(a)</span><br><span class="line">        t.end_fill()</span><br><span class="line"></span><br><span class="line">t.pu()</span><br><span class="line">t.seth(90)</span><br><span class="line">t.fd(25)</span><br><span class="line">t.seth(0)</span><br><span class="line">t.fd(10)</span><br><span class="line">t.pd()</span><br><span class="line">t.pencolor(255, 155, 192)</span><br><span class="line">t.seth(10)</span><br><span class="line">t.begin_fill()</span><br><span class="line">t.circle(5)</span><br><span class="line">t.color(160, 82, 45)</span><br><span class="line">t.end_fill()</span><br><span class="line"></span><br><span class="line">t.pu()</span><br><span class="line">t.seth(0)</span><br><span class="line">t.fd(20)</span><br><span class="line">t.pd()</span><br><span class="line">t.pencolor(255, 155, 192)</span><br><span class="line">t.seth(10)</span><br><span class="line">t.begin_fill()</span><br><span class="line">t.circle(5)</span><br><span class="line">t.color(160, 82, 45)</span><br><span class="line">t.end_fill()</span><br><span class="line"></span><br><span class="line"># 头</span><br><span class="line">t.color((255, 155, 192), &quot;pink&quot;)</span><br><span class="line">t.pu()</span><br><span class="line">t.seth(90)</span><br><span class="line">t.fd(41)</span><br><span class="line">t.seth(0)</span><br><span class="line">t.fd(0)</span><br><span class="line">t.pd()</span><br><span class="line">t.begin_fill()</span><br><span class="line">t.seth(180)</span><br><span class="line">t.circle(300, -30)</span><br><span class="line">t.circle(100, -60)</span><br><span class="line">t.circle(80, -100)</span><br><span class="line">t.circle(150, -20)</span><br><span class="line">t.circle(60, -95)</span><br><span class="line">t.seth(161)</span><br><span class="line">t.circle(-300, 15)</span><br><span class="line">t.pu()</span><br><span class="line">t.goto(-100, 100)</span><br><span class="line">t.pd()</span><br><span class="line">t.seth(-30)</span><br><span class="line">a &#x3D; 0.4</span><br><span class="line">for i in range(60):</span><br><span class="line">    if 0 &lt;&#x3D; i &lt; 30 or 60 &lt;&#x3D; i &lt;90:</span><br><span class="line">        a &#x3D; a+0.08</span><br><span class="line">        t.lt(3)  # 向左转3度</span><br><span class="line">        t.fd(a)  # 向前走a的步长</span><br><span class="line">    else:</span><br><span class="line">        a &#x3D; a-0.08</span><br><span class="line">        t.lt(3)</span><br><span class="line">        t.fd(a)</span><br><span class="line">        t.end_fill()</span><br><span class="line"></span><br><span class="line"># 耳朵</span><br><span class="line">t.color((255, 155, 192), &quot;pink&quot;)</span><br><span class="line">t.pu()</span><br><span class="line">t.seth(90)</span><br><span class="line">t.fd(-7)</span><br><span class="line">t.seth(0)</span><br><span class="line">t.fd(70)</span><br><span class="line">t.pd()</span><br><span class="line">t.begin_fill()</span><br><span class="line">t.seth(100)</span><br><span class="line">t.circle(-50, 50)</span><br><span class="line">t.circle(-10, 120)</span><br><span class="line">t.circle(-50, 54)</span><br><span class="line">t.end_fill()</span><br><span class="line"></span><br><span class="line">t.pu()</span><br><span class="line">t.seth(90)</span><br><span class="line">t.fd(-12)</span><br><span class="line">t.seth(0)</span><br><span class="line">t.fd(30)</span><br><span class="line">t.pd()</span><br><span class="line">t.begin_fill()</span><br><span class="line">t.seth(100)</span><br><span class="line">t.circle(-50, 50)</span><br><span class="line">t.circle(-10, 120)</span><br><span class="line">t.circle(-50, 56)</span><br><span class="line">t.end_fill()</span><br><span class="line"></span><br><span class="line">#眼睛</span><br><span class="line">t.color((255, 155, 192), &quot;white&quot;)</span><br><span class="line">t.pu()</span><br><span class="line">t.seth(90)</span><br><span class="line">t.fd(-20)</span><br><span class="line">t.seth(0)</span><br><span class="line">t.fd(-95)</span><br><span class="line">t.pd()</span><br><span class="line">t.begin_fill()</span><br><span class="line">t.circle(15)</span><br><span class="line">t.end_fill()</span><br><span class="line"></span><br><span class="line">t.color(&quot;black&quot;)</span><br><span class="line">t.pu()</span><br><span class="line">t.seth(90)</span><br><span class="line">t.fd(12)</span><br><span class="line">t.seth(0)</span><br><span class="line">t.fd(-3)</span><br><span class="line">t.pd()</span><br><span class="line">t.begin_fill()</span><br><span class="line">t.circle(3)</span><br><span class="line">t.end_fill()</span><br><span class="line"></span><br><span class="line">t.color((255, 155, 192), &quot;white&quot;)</span><br><span class="line">t.pu()</span><br><span class="line">t.seth(90)</span><br><span class="line">t.fd(-25)</span><br><span class="line">t.seth(0)</span><br><span class="line">t.fd(40)</span><br><span class="line">t.pd()</span><br><span class="line">t.begin_fill()</span><br><span class="line">t.circle(15)</span><br><span class="line">t.end_fill()</span><br><span class="line"></span><br><span class="line">t.color(&quot;black&quot;)</span><br><span class="line">t.pu()</span><br><span class="line">t.seth(90)</span><br><span class="line">t.fd(12)</span><br><span class="line">t.seth(0)</span><br><span class="line">t.fd(-3)</span><br><span class="line">t.pd()</span><br><span class="line">t.begin_fill()</span><br><span class="line">t.circle(3)</span><br><span class="line">t.end_fill()</span><br><span class="line"></span><br><span class="line"># 腮</span><br><span class="line">t.color((255, 155, 192))</span><br><span class="line">t.pu()</span><br><span class="line">t.seth(90)</span><br><span class="line">t.fd(-95)</span><br><span class="line">t.seth(0)</span><br><span class="line">t.fd(65)</span><br><span class="line">t.pd()</span><br><span class="line">t.begin_fill()</span><br><span class="line">t.circle(30)</span><br><span class="line">t.end_fill()</span><br><span class="line"></span><br><span class="line"># 嘴</span><br><span class="line">t.color(239, 69, 19)</span><br><span class="line">t.pu()</span><br><span class="line">t.seth(90)</span><br><span class="line">t.fd(15)</span><br><span class="line">t.seth(0)</span><br><span class="line">t.fd(-100)</span><br><span class="line">t.pd()</span><br><span class="line">t.seth(-80)</span><br><span class="line">t.circle(30, 40)</span><br><span class="line">t.circle(40, 80)</span><br><span class="line"></span><br><span class="line"># 身体</span><br><span class="line">t.color(&quot;red&quot;, (255, 99, 71))</span><br><span class="line">t.pu()</span><br><span class="line">t.seth(90)</span><br><span class="line">t.fd(-20)</span><br><span class="line">t.seth(0)</span><br><span class="line">t.fd(-78)</span><br><span class="line">t.pd()</span><br><span class="line">t.begin_fill()</span><br><span class="line">t.seth(-130)</span><br><span class="line">t.circle(100,10)</span><br><span class="line">t.circle(300,30)</span><br><span class="line">t.seth(0)</span><br><span class="line">t.fd(230)</span><br><span class="line">t.seth(90)</span><br><span class="line">t.circle(300,30)</span><br><span class="line">t.circle(100,3)</span><br><span class="line">t.color((255,155,192),(255,100,100))</span><br><span class="line">t.seth(-135)</span><br><span class="line">t.circle(-80,63)</span><br><span class="line">t.circle(-150,24)</span><br><span class="line">t.end_fill()</span><br><span class="line"></span><br><span class="line"># 手</span><br><span class="line">t.color((255,155,192))</span><br><span class="line">t.pu()</span><br><span class="line">t.seth(90)</span><br><span class="line">t.fd(-40)</span><br><span class="line">t.seth(0)</span><br><span class="line">t.fd(-27)</span><br><span class="line">t.pd()</span><br><span class="line">t.seth(-160)</span><br><span class="line">t.circle(300,15)</span><br><span class="line">t.pu()</span><br><span class="line">t.seth(90)</span><br><span class="line">t.fd(15)</span><br><span class="line">t.seth(0)</span><br><span class="line">t.fd(0)</span><br><span class="line">t.pd()</span><br><span class="line">t.seth(-10)</span><br><span class="line">t.circle(-20,90)</span><br><span class="line"></span><br><span class="line">t.pu()</span><br><span class="line">t.seth(90)</span><br><span class="line">t.fd(30)</span><br><span class="line">t.seth(0)</span><br><span class="line">t.fd(237)</span><br><span class="line">t.pd()</span><br><span class="line">t.seth(-20)</span><br><span class="line">t.circle(-300,15)</span><br><span class="line">t.pu()</span><br><span class="line">t.seth(90)</span><br><span class="line">t.fd(20)</span><br><span class="line">t.seth(0)</span><br><span class="line">t.fd(0)</span><br><span class="line">t.pd()</span><br><span class="line">t.seth(-170)</span><br><span class="line">t.circle(20,90)</span><br><span class="line"></span><br><span class="line"># 脚</span><br><span class="line">t.pensize(10)</span><br><span class="line">t.color((240,128,128))</span><br><span class="line">t.pu()</span><br><span class="line">t.seth(90)</span><br><span class="line">t.fd(-75)</span><br><span class="line">t.seth(0)</span><br><span class="line">t.fd(-180)</span><br><span class="line">t.pd()</span><br><span class="line">t.seth(-90)</span><br><span class="line">t.fd(40)</span><br><span class="line">t.seth(-180)</span><br><span class="line">t.color(&quot;black&quot;)</span><br><span class="line">t.pensize(15)</span><br><span class="line">t.fd(20)</span><br><span class="line"></span><br><span class="line">t.pensize(10)</span><br><span class="line">t.color((240, 128, 128))</span><br><span class="line">t.pu()</span><br><span class="line">t.seth(90)</span><br><span class="line">t.fd(40)</span><br><span class="line">t.seth(0)</span><br><span class="line">t.fd(90)</span><br><span class="line">t.pd()</span><br><span class="line">t.seth(-90)</span><br><span class="line">t.fd(40)</span><br><span class="line">t.seth(-180)</span><br><span class="line">t.color(&quot;black&quot;)</span><br><span class="line">t.pensize(15)</span><br><span class="line">t.fd(20)</span><br><span class="line"></span><br><span class="line"># 尾巴</span><br><span class="line">t.pensize(4)</span><br><span class="line">t.color((255, 155, 192))</span><br><span class="line">t.pu()</span><br><span class="line">t.seth(90)</span><br><span class="line">t.fd(70)</span><br><span class="line">t.seth(0)</span><br><span class="line">t.fd(95)</span><br><span class="line">t.pd()</span><br><span class="line">t.seth(0)</span><br><span class="line">t.circle(70, 20)</span><br><span class="line">t.circle(10, 330)</span><br><span class="line">t.circle(70, 30)</span><br><span class="line">t.done()</span><br></pre></td></tr></table></figure>
<blockquote>
<p> 来自于cnblogs</p>
</blockquote>

      </div>
      
        <br>
        <blockquote>
<p>本文作者 :Chident<br>版权声明 :Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)</p>
</blockquote>

      
      
        <br>
        


  <section class='meta' id="footer-meta">
    <div class='new-meta-box'>
      
        
          <div class="new-meta-item date" itemprop="dateUpdated" datetime="2020-02-02T18:55:33+08:00">
  <a class='notlink'>
    <i class="fas fa-clock" aria-hidden="true"></i>
    <p>更新于 2020年2月2日</p>
  </a>
</div>

        
      
        
          
  
  <div class="new-meta-item meta-tags"><a class="tag" href="/tags/%E7%BC%96%E7%A8%8B/" rel="nofollow"><i class="fas fa-tag" aria-hidden="true"></i><p>编程</p></a></div>


        
      
        
          
  <div class="new-meta-item share -mob-share-list">
  <div class="-mob-share-list share-body">
    
      
        <a class="-mob-share-qq" title="QQ好友" rel="external nofollow noopener noreferrer"
          
          href="http://connect.qq.com/widget/shareqq/index.html?url=https://chident.gitee.io/blog/%E6%89%BE%E5%88%B0%E4%B8%80%E4%B8%AA%E5%BE%88%E5%A5%BD%E7%8E%A9%E7%9A%84python%E4%BB%A3%E7%A0%81/&title=找到一个很好玩的python代码 | 微笔记，大内涵&summary=这是一个画佩奇的代码,调用了python的turtle库"
          
          >
          
            <img src="https://cdn.jsdelivr.net/gh/xaoxuu/assets@19.1.9/logo/128/qq.png">
          
        </a>
      
    
      
        <a class="-mob-share-qzone" title="QQ空间" rel="external nofollow noopener noreferrer"
          
          href="https://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=https://chident.gitee.io/blog/%E6%89%BE%E5%88%B0%E4%B8%80%E4%B8%AA%E5%BE%88%E5%A5%BD%E7%8E%A9%E7%9A%84python%E4%BB%A3%E7%A0%81/&title=找到一个很好玩的python代码 | 微笔记，大内涵&summary=这是一个画佩奇的代码,调用了python的turtle库"
          
          >
          
            <img src="https://cdn.jsdelivr.net/gh/xaoxuu/assets@19.1.9/logo/128/qzone.png">
          
        </a>
      
    
      
        <a class='qrcode' rel="external nofollow noopener noreferrer" href=''>
        
        </a>
      
    
      
        <a class="-mob-share-weibo" title="微博" rel="external nofollow noopener noreferrer"
          
          href="http://service.weibo.com/share/share.php?url=https://chident.gitee.io/blog/%E6%89%BE%E5%88%B0%E4%B8%80%E4%B8%AA%E5%BE%88%E5%A5%BD%E7%8E%A9%E7%9A%84python%E4%BB%A3%E7%A0%81/&title=找到一个很好玩的python代码 | 微笔记，大内涵&summary=这是一个画佩奇的代码,调用了python的turtle库"
          
          >
          
            <img src="https://cdn.jsdelivr.net/gh/xaoxuu/assets@19.1.9/logo/128/weibo.png">
          
        </a>
      
    
  </div>
</div>



        
      
    </div>
  </section>


      
      
          <div class="prev-next">
              
                  <section class="prev">
                      <span class="art-item-left">
                          <h6><i class="fas fa-chevron-left" aria-hidden="true"></i>&nbsp;上一页</h6>
                          <h4>
                              <a href="/blog/%E7%AE%80%E6%98%93%E7%9A%84%E9%87%8D%E8%A3%85%E7%B3%BB%E7%BB%9F/" rel="prev" title="简易的重装系统">
                                
                                    简易的重装系统
                                
                              </a>
                          </h4>
                          
                              
                              <h6 class="tags">
                                  <a class="tag" href="/tags/%E6%8A%80%E6%9C%AF/"><i class="fas fa-tag fa-fw" aria-hidden="true"></i> 技术</a>
                              </h6>
                          
                      </span>
                  </section>
              
              
                  <section class="next">
                      <span class="art-item-right" aria-hidden="true">
                          <h6>下一页&nbsp;<i class="fas fa-chevron-right" aria-hidden="true"></i></h6>
                          <h4>
                              <a href="/blog/%E7%A5%9E%E7%A7%98%E8%BD%AF%E4%BB%B6%E5%88%86%E4%BA%AB/" rel="prev" title="神秘软件分享">
                                  
                                      神秘软件分享
                                  
                              </a>
                          </h4>
                          
                              
                              <h6 class="tags">
                                  <a class="tag" href="/tags/%E8%BD%AF%E4%BB%B6/"><i class="fas fa-tag fa-fw" aria-hidden="true"></i> 软件</a>
                              </h6>
                          
                      </span>
                  </section>
              
          </div>
      
    </section>
  </article>



  <!-- 显示推荐文章和评论 -->



  <article class="post white-box comments">
    <section class="article typo">
      <h4><i class="fas fa-comments fa-fw" aria-hidden="true"></i>&nbsp;评论</h4>
      
      
      
      
        <section id="comments">
          <div id="valine_container" class="valine_thread">
            <i class="fas fa-spinner fa-spin fa-fw"></i>
          </div>
        </section>
      
    </section>
  </article>






<!-- 根据页面mathjax变量决定是否加载MathJax数学公式js -->



  <script>
    window.subData = {
      title: '找到一个很好玩的python代码',
      tools: true
    }
  </script>


</div>
<aside class='l_side'>
  
    
    
      
      
        
          
          
        
          
          
        
          
          
        
          
          
        
          
          
        
          
          
        
      
        
          
          
        
          
          
            
              

            
          
        
          
          
        
          
          
        
          
          
        
          
          
        
      
        
          
          
        
          
          
        
          
          
        
          
          
        
          
          
        
          
          
        
      
        
          
          
        
          
          
        
          
          
        
          
          
        
          
          
        
          
          
        
      
    

  
</aside>

<footer id="footer" class="clearfix">
  
  
    <div class="social-wrapper">
      
        
          <a href="/atom.xml"
            class="social fas fa-rss flat-btn"
            target="_blank"
            rel="external nofollow noopener noreferrer">
          </a>
        
      
        
          <a href="mailto:452834911@qq.com"
            class="social fas fa-envelope flat-btn"
            target="_blank"
            rel="external nofollow noopener noreferrer">
          </a>
        
      
        
          <a href="https://github.com/wedont"
            class="social fab fa-github flat-btn"
            target="_blank"
            rel="external nofollow noopener noreferrer">
          </a>
        
      
        
          <a href="http://wpa.qq.com/msgrd?v=3&amp;uin=452834911&amp;site=qq&amp;menu=yes"
            class="social fab fa-qq flat-btn"
            target="_blank"
            rel="external nofollow noopener noreferrer">
          </a>
        
      
    </div>
  
  <br>
  <div><p>博客内容遵循 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh" target="_blank" rel="noopener">署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0) 协议</a></p>
</div>
  <div>
    本站使用
    <a href="https://xaoxuu.com/wiki/material-x/" target="_blank" class="codename">Material X</a>
    作为主题
    
      ，
      总访问量为
      <span id="busuanzi_value_site_pv"><i class="fas fa-spinner fa-spin fa-fw" aria-hidden="true"></i></span>
      次
    
    。
  </div>
<span id="timeDate">载入天数...</span><span id="times">载入时分秒...</span>
<script>
    var now = new Date(); 
    function createtime() { 
        var grt= new Date("08/10/2018 17:38:00");//在此处修改你的建站时间，格式：月/日/年 时:分:秒
        now.setTime(now.getTime()+250); 
        days = (now - grt ) / 1000 / 60 / 60 / 24; dnum = Math.floor(days); 
        hours = (now - grt ) / 1000 / 60 / 60 - (24 * dnum); hnum = Math.floor(hours); 
        if(String(hnum).length ==1 ){hnum = "0" + hnum;} minutes = (now - grt ) / 1000 /60 - (24 * 60 * dnum) - (60 * hnum); 
        mnum = Math.floor(minutes); if(String(mnum).length ==1 ){mnum = "0" + mnum;} 
        seconds = (now - grt ) / 1000 - (24 * 60 * 60 * dnum) - (60 * 60 * hnum) - (60 * mnum); 
        snum = Math.round(seconds); if(String(snum).length ==1 ){snum = "0" + snum;} 
        document.getElementById("timeDate").innerHTML = "本站已安全运行 "+dnum+" 天 "; 
        document.getElementById("times").innerHTML = hnum + " 小时 " + mnum + " 分 " + snum + " 秒"; 
    } 
setInterval("createtime()",250);
</script>
<span class="post-count">  字数统计：3.4k</span>
</footer>
<script>setLoadingBarProgress(80);</script>
<i class="fas fa-chart-area"></i>


      <script>setLoadingBarProgress(60);</script>
    </div>
    <a class="s-top fas fa-arrow-up fa-fw" href='javascript:void(0)'></a>
  </div>
  <script src="https://cdn.jsdelivr.net/npm/jquery@3.3.1/dist/jquery.min.js"></script>

  <script>
    var GOOGLE_CUSTOM_SEARCH_API_KEY = "";
    var GOOGLE_CUSTOM_SEARCH_ENGINE_ID = "";
    var ALGOLIA_API_KEY = "";
    var ALGOLIA_APP_ID = "";
    var ALGOLIA_INDEX_NAME = "";
    var AZURE_SERVICE_NAME = "";
    var AZURE_INDEX_NAME = "";
    var AZURE_QUERY_KEY = "";
    var BAIDU_API_ID = "";
    var SEARCH_SERVICE = "hexo" || "hexo";
    var ROOT = "/"||"/";
    if(!ROOT.endsWith('/'))ROOT += '/';
  </script>

<script src="//instant.page/1.2.2" type="module" integrity="sha384-2xV8M5griQmzyiY3CDqh1dn4z3llDVqZDqzjzcY+jCBCk/a5fXJmuZ/40JJAPeoU"></script>


  <script async src="https://cdn.jsdelivr.net/npm/scrollreveal@4.0.5/dist/scrollreveal.min.js"></script>
  <script type="text/javascript">
    $(function() {
      const $reveal = $('.reveal');
      if ($reveal.length === 0) return;
      const sr = ScrollReveal({ distance: 0 });
      sr.reveal('.reveal');
    });
  </script>


  <script src="https://cdn.jsdelivr.net/npm/node-waves@0.7.6/dist/waves.min.js"></script>
  <script type="text/javascript">
    $(function() {
      Waves.attach('.flat-btn', ['waves-button']);
      Waves.attach('.float-btn', ['waves-button', 'waves-float']);
      Waves.attach('.float-btn-light', ['waves-button', 'waves-float', 'waves-light']);
      Waves.attach('.flat-box', ['waves-block']);
      Waves.attach('.float-box', ['waves-block', 'waves-float']);
      Waves.attach('.waves-image');
      Waves.init();
    });
  </script>


  <script async src="https://cdn.jsdelivr.net/gh/xaoxuu/cdn-busuanzi@2.3/js/busuanzi.pure.mini.js"></script>




  
  
  
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-backstretch/2.0.4/jquery.backstretch.min.js"></script>
    <script type="text/javascript">
      $(function(){
        if ('.cover') {
          $('.cover').backstretch(
          ["https://s2.ax1x.com/2020/02/02/1Ypb4I.png"],
          {
            duration: "6000",
            fade: "2500"
          });
        } else {
          $.backstretch(
          ["https://s2.ax1x.com/2020/02/02/1Ypb4I.png"],
          {
            duration: "6000",
            fade: "2500"
          });
        }
      });
    </script>
  









  <script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
  
    
      
<script src="https://cdn.jsdelivr.net/gh/xaoxuu/volantis@1.0.6/js/volantis.min.js"></script>

    
  
  <script>
  var GUEST_INFO = ['nick','mail','link'];
  var guest_info = 'nick,mail,link'.split(',').filter(function(item){
    return GUEST_INFO.indexOf(item) > -1
  });
  var notify = 'true' == true;
  var verify = 'true' == true;
  var valine = new Valine();
  valine.init({
    el: '#valine_container',
    notify: notify,
    verify: verify,
    guest_info: guest_info,
    
    appId: "h04mzRryD5nGhGUb2bOFUYrS-gzGzoHsz",
    appKey: "39zxrsok0MCJ5UdojPuqTUvG",
    placeholder: "快来评论吧~",
    pageSize:'10',
    avatar:'mp',
    lang:'zh-cn',
    highlight:'true'
  })
  </script>



  
<script src="https://cdn.jsdelivr.net/gh/xaoxuu/cdn-material-x@19.11/js/app.js"></script>



  
<script src="https://cdn.jsdelivr.net/gh/xaoxuu/cdn-material-x@19.11/js/search.js"></script>





<!-- 复制 -->
<script src="https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js"></script>
<script>
  let COPY_SUCCESS = "复制成功";
  let COPY_FAILURE = "复制失败";
  /*页面载入完成后，创建复制按钮*/
  !function (e, t, a) {
    /* code */
    var initCopyCode = function(){
      var copyHtml = '';
      copyHtml += '<button class="btn-copy" data-clipboard-snippet="">';
      copyHtml += '  <i class="fa fa-copy"></i><span>复制</span>';
      copyHtml += '</button>';
      $(".highlight .code pre").before(copyHtml);
      var clipboard = new ClipboardJS('.btn-copy', {
        target: function(trigger) {
          return trigger.nextElementSibling;
        }
      });

      clipboard.on('success', function(e) {
        //您可以加入成功提示
        console.info('Action:', e.action);
        console.info('Text:', e.text);
        console.info('Trigger:', e.trigger);
        success_prompt(COPY_SUCCESS);
        e.clearSelection();
      });
      clipboard.on('error', function(e) {
        //您可以加入失败提示
        console.error('Action:', e.action);
        console.error('Trigger:', e.trigger);
        fail_prompt(COPY_FAILURE);
      });
    }
    initCopyCode();

  }(window, document);

  /**
   * 弹出式提示框，默认1.5秒自动消失
   * @param message 提示信息
   * @param style 提示样式，有alert-success、alert-danger、alert-warning、alert-info
   * @param time 消失时间
   */
  var prompt = function (message, style, time)
  {
      style = (style === undefined) ? 'alert-success' : style;
      time = (time === undefined) ? 1500 : time*1000;
      $('<div>')
          .appendTo('body')
          .addClass('alert ' + style)
          .html(message)
          .show()
          .delay(time)
          .fadeOut();
  };

  // 成功提示
  var success_prompt = function(message, time)
  {
      prompt(message, 'alert-success', time);
  };

  // 失败提示
  var fail_prompt = function(message, time)
  {
      prompt(message, 'alert-danger', time);
  };

  // 提醒
  var warning_prompt = function(message, time)
  {
      prompt(message, 'alert-warning', time);
  };

  // 信息提示
  var info_prompt = function(message, time)
  {
      prompt(message, 'alert-info', time);
  };

</script>


<!-- fancybox -->
<script src="https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.js"></script>
<script>
  let LAZY_LOAD_IMAGE = "";
  $(".article-entry").find("fancybox").find("img").each(function () {
      var element = document.createElement("a");
      $(element).attr("data-fancybox", "gallery");
      $(element).attr("href", $(this).attr("src"));
      /* 图片采用懒加载处理时,
       * 一般图片标签内会有个属性名来存放图片的真实地址，比如 data-original,
       * 那么此处将原本的属性名src替换为对应属性名data-original,
       * 修改如下
       */
       if (LAZY_LOAD_IMAGE) {
         $(element).attr("href", $(this).attr("data-original"));
       }
      $(this).wrap(element);
  });
</script>





  <script>setLoadingBarProgress(100);</script>
<script src="/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"pluginRootPath":"live2dw/","pluginJsPath":"lib/","pluginModelPath":"assets/","tagMode":false,"debug":false,"model":{"jsonPath":"/live2dw/assets/shizuku.model.json"},"display":{"position":"right","width":150,"height":300},"mobile":{"show":false},"react":{"opacity":0.7},"log":false});</script></body>
</html>
<!--单击显示文字-->
<script type="text/javascript" src="/js/click_show_text.js"></script>